package com.learn.controller;

import com.learn.entity.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Controller
@RequestMapping(value = {"/tpl"}, method = { RequestMethod.GET }, produces="application/json;charset=UTF-8")
public class TplController {
    /*@Autowired
    private PersonMybatisService personMybatisService;*/
    //http://192.168.198.128:4001/tpl/
    @GetMapping("/")
    public String tpl(Model model ) {
        model.addAttribute("projectName", "learn");
        return "hello";
    }

    /*@GetMapping("/list")
    public String list(Model model ) throws ParseException {
        List<Person> list = personMybatisService.getlist();
        SimpleDateFormat format =  new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        for ( Person person: list ) {
            person.setDateCreateTime( format.format(new Date(Long.parseLong( person.getCreatetime()+"000" ))) );
        }
        model.addAttribute("list", list);
        return "list";
    }*/

}
